public class Main {

    public static void main(String[] args) {

        LinkedList<Integer> linkedList = new LinkedList<>();
        for (int i = 0; i < 5; i++) {
            linkedList.addFirst(i);
            System.out.println(linkedList);
        }

        linkedList.add(2,666);
        System.out.println(linkedList);

        linkedList.remove(2);
        System.out.println(linkedList);

        linkedList.removeFirst();
        System.out.println(linkedList);

        linkedList.removeLast();
        System.out.println(linkedList);




//        LinkedList<String> stringLinkedList = new LinkedList<>();
//        for (int i = 0; i < 6; i++) {
//            stringLinkedList.addLast(String.valueOf(i));
//        }
//        System.out.println(stringLinkedList);
//
//        System.out.println(stringLinkedList);

//        for (int i = 1; i < 11; i++) {
//
//            stringLinkedList.addLast(String.valueOf(i));
//        }
//        System.out.println(stringLinkedList);
//        reversePrint(stringLinkedList,4);
//        System.out.println(stringLinkedList);


    }

//    private static void reversePrint(LinkedList<String> stringLinkedList, int i) {
//
//        Node current_node
//
//    }


}

